home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip: 2005 Utilities
/
CHIP Utilities 2005.7z
/
CHIP Utilities 2005.iso
/
images
/
fd32rdp.igz
/
fd32rdp.img
/
LEVEL0
/
DOSRDP.CAB
/
bin
/
dosrdp.bat
next >
Wrap
DOS Batch File
|
2005-01-16
|
10KB
|
282 lines
@if "%debug%"=="" echo off
if "%1"==":" if not "%2"=="" goto %2
:: Dosrdp Begin ::
if not exist %ramdrv%\bin\lmod.com %0 : _error missing lmod.com (check utils.%arcext%)
if not exist %ramdrv%\bin\varset.com %0 : _error missing varset.com (check utilz.%arcext%)
if "%wattcp.cfg%"=="" %0 : _error missing WATTCP (packet driver)
if not exist %wattcp.cfg%\wattcp.cfg %0 : _error missing %wattcp.cfg%\wattcp.cfg
if not exist %wattcp.cfg%\tcp.cfg %0 : _error missing %wattcp.cfg%\tcp.cfg
if exist PROTMAN$ if not exist PKTDRV$ %0 : _error MsClient packet driver missing (MSNET)
if not exist %ramdrv%\bin\pktchk.com goto _npktchk
%ramdrv%\bin\pktchk.com 0x20 0xff >%tmp%\nul
if errorlevel 1 %0 : _error missing packet driver
:_npktchk
:_start
echo @if "%%debug%%"=="" echo off >%tmp%\_Dosrdp.bat
inifile %wattcp.cfg%\tcp.cfg [] colordepth | lmod set rdp_color=[$3]>>%tmp%\_Dosrdp.bat
inifile %wattcp.cfg%\tcp.cfg [] video | lmod set rdp_video=[$3]>>%tmp%\_Dosrdp.bat
inifile %wattcp.cfg%\tcp.cfg [] refreshrate | lmod set rdp_refr=[$3]>>%tmp%\_Dosrdp.bat
inifile %wattcp.cfg%\tcp.cfg [] server | lmod set rdp_srvr=[$3]>>%tmp%\_Dosrdp.bat
inifile %wattcp.cfg%\tcp.cfg [] mouse | lmod set rdp_mouse=[$3]>>%tmp%\_Dosrdp.bat
inifile %wattcp.cfg%\tcp.cfg [] keyboard | lmod set rdp_keyb=[$3]>>%tmp%\_Dosrdp.bat
inifile %wattcp.cfg%\tcp.cfg [] port | lmod set rdp_port=[$3]>>%tmp%\_Dosrdp.bat
inifile %wattcp.cfg%\tcp.cfg [] flash | lmod set rdp_flash=[$3]>>%tmp%\_Dosrdp.bat
inifile %wattcp.cfg%\tcp.cfg [] startup | lmod set rdp_start=[$3]>>%tmp%\_Dosrdp.bat
inifile %wattcp.cfg%\tcp.cfg [] user | lmod set rdp_user=[$3]>>%tmp%\_Dosrdp.bat
inifile %wattcp.cfg%\tcp.cfg [] password | lmod set rdp_pass=[$3]>>%tmp%\_Dosrdp.bat
call %tmp%\_Dosrdp.bat
del %tmp%\_Dosrdp.bat >%tmp%\nul
echo. >%tmp%\_Dosrdp.tmp
if not exist %ramdrv%\etc\global.set goto _noglob
type %ramdrv%\etc\global.set >%tmp%\_Dosrdp.tmp
:_noglob
if not exist %ramdrv%\etc\Dosrdp.set goto _nospec
type %ramdrv%\etc\Dosrdp.set >%tmp%\_Dosrdp.tmp
:_nospec
xgrep -sy "^[:s]*@*[:s]*s?e?t?[:s]*rdp_.+=" %tmp%\_Dosrdp.tmp >%tmp%\_Dosrdp.bak
if errorlevel 1 goto _noset
xgrep -sy "^[:s]*@*[:s]*set[:s]+" %tmp%\_Dosrdp.bak >%tmp%\_Dosrdp.bat
xgrep -syv "^[:s]*@*[:s]*set[:s]+" %tmp%\_Dosrdp.bak >%tmp%\_Dosrdp.tmp
if errorlevel 1 goto _runset
lmod /L* set []<%tmp%\_Dosrdp.tmp >>%tmp%\_Dosrdp.bat
:_runset
call %tmp%\_Dosrdp.bat
:_noset
if "%rdp_video%"=="" set rdp_video=640*480
if "%rdp_refr%"=="" set rdp_refr=75HZ
if "%rdp_color%"=="" set rdp_color=8
if "%rdp_mouse%"=="" set rdp_mouse=logitech
if "%rdp_keyb%"=="" set rdp_keyb=1033
if "%rdp_port%"=="" set rdp_port=3389
if "%rdp_ti%"=="" set rdp_ti=30
for %%i in (-c -C) do if "%1"=="%%i" goto _config
if "%1"=="/c" goto _config
if "%1"=="/C" goto _config
for %%i in (-h -H -?) do if "%1"=="%%i" goto _usage
if "%1"=="/h" goto _usage
if "%1"=="/H" goto _usage
if "%1"=="/?" goto _usage
if "%rdp_ncfg%"=="1" goto _nocfg
if not "%1"=="" set rdp_srvr=%1
call w.bat box @%0:w_cfg #2,%rdp_ti%
if errorlevel 3 goto _end
if errorlevel 2 goto _config
:_nocfg
:_install
if "%rdp_video%"=="" set rdp_video=640*480
if "%rdp_refr%"=="" set rdp_refr=75HZ
if "%rdp_color%"=="" set rdp_color=8
if "%rdp_mouse%"=="" set rdp_mouse=logitech
if "%rdp_keyb%"=="" set rdp_keyb=1033
if "%rdp_port%"=="" set rdp_port=3389
el! 0
inifile %wattcp.cfg%\tcp.cfg [] refreshrate=%rdp_refr%
if errorlevel 1 %0 : _error problem writing %wattcp.cfg%\tcp.cfg
inifile %wattcp.cfg%\tcp.cfg [] mouse=%rdp_mouse%
if errorlevel 1 %0 : _error problem writing %wattcp.cfg%\tcp.cfg
inifile %wattcp.cfg%\tcp.cfg [] keyboard=%rdp_keyb%
if errorlevel 1 %0 : _error problem writing %wattcp.cfg%\tcp.cfg
inifile %wattcp.cfg%\tcp.cfg [] colordepth=%rdp_color%
if errorlevel 1 %0 : _error problem writing %wattcp.cfg%\tcp.cfg
inifile %wattcp.cfg%\tcp.cfg [] video=%rdp_video%
if errorlevel 1 %0 : _error problem writing %wattcp.cfg%\tcp.cfg
inifile %wattcp.cfg%\tcp.cfg [] port=%rdp_port%
if errorlevel 1 %0 : _error problem writing %wattcp.cfg%\tcp.cfg
inifile %wattcp.cfg%\tcp.cfg [] flash=%rdp_flash%
if errorlevel 1 %0 : _error problem writing %wattcp.cfg%\tcp.cfg
inifile %wattcp.cfg%\tcp.cfg [] startup=%rdp_start%
if errorlevel 1 %0 : _error problem writing %wattcp.cfg%\tcp.cfg
inifile %wattcp.cfg%\tcp.cfg [] server=%rdp_srvr%
if errorlevel 1 %0 : _error problem writing %wattcp.cfg%\tcp.cfg
inifile %wattcp.cfg%\tcp.cfg [] user=%rdp_user%
if errorlevel 1 %0 : _error problem writing %wattcp.cfg%\tcp.cfg
inifile %wattcp.cfg%\tcp.cfg [] password=%rdp_pass%
if errorlevel 1 %0 : _error problem writing %wattcp.cfg%\tcp.cfg
set rdp_pass=
tfind /e "server" "=" <%wattcp.cfg%\tcp.cfg >%tmp%\nul
if errorlevel 1 goto _noadd
echo server= >>%wattcp.cfg%\tcp.cfg
:_noadd
if not "%rdp_srvr%"=="" goto _doit
if not "%1"=="" goto _doit
echo DOSRDP: No Target Terminal Server (Remote Desktop) specified
goto _end
:_doit
%ramdrv%
cd %wattcp.cfg%
if exist %ramdrv%\etc\g4w.dat if exist %wattcp.cfg%\g4w.dat del %wattcp.cfg%\g4w.dat >%tmp%\nul
if exist %ramdrv%\etc\g4w.dat copy %ramdrv%\etc\g4w.dat %wattcp.cfg%\g4w.dat >%tmp%\nul
if exist g2.exe goto _launch
if exist %ramdrv%\bin\g2.exe copy %ramdrv%\bin\g2.exe . >%tmp%\nul
if not exist g2.exe %0 : _error missing g2.exe
:_launch
if exist %ramdrv%\bin\g2.exe del %ramdrv%\bin\g2.exe >%tmp%\nul
if not "%rdp_vesa%"=="1" goto _g2
if not exist %ramdrv%\bin\univesa.exe if not exist %ramdrv%\bin\univbe.exe goto _g2
if exist %ramdrv%\bin\univesa.exe %ramdrv%\bin\univesa.exe
if exist %ramdrv%\bin\univesa.exe goto _g2
if exist %ramdrv%\bin\univbe.exe %ramdrv%\bin\univbe.exe
if exist %ramdrv%\bin\univbe.exe goto _g2
:_g2
if not "%1"=="" echo DOSRDP: Connecting to Terminal Server (Remote Desktop) '%1'
if "%1"=="" echo DOSRDP: Connecting to Terminal Server (Remote Desktop) '%rdp_srvr%'
for %%i in (1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25) do echo.
g2.exe %1 %2 %3 %4 %5 %6 %7 %8
cd \
goto _end
:_config
if not "%1"=="" set rdp_srvr=%1
echo :w_config "DosRdp configuration" [x]>%tmp%\_Dosrdp.tmp
echo.>>%tmp%\_Dosrdp.tmp
echo Dialog timeout [$ rdp_ti,3] seconds.>>%tmp%\_Dosrdp.tmp
echo [!] Skip "Run DosRdp or go config?" dialog>>%tmp%\_Dosrdp.tmp
echo.>>%tmp%\_Dosrdp.tmp
echo TServer [$ rdp_srvr,64 ] >>%tmp%\_Dosrdp.tmp
echo User [$ rdp_user,64 ] >>%tmp%\_Dosrdp.tmp
echo Password [$ rdp_pass,64,P ] (better leave blank) >>%tmp%\_Dosrdp.tmp
echo Startup [$ rdp_start,128,L] (autostart program) >>%tmp%\_Dosrdp.tmp
echo Port [$ rdp_port,5] (default 3389) >>%tmp%\_Dosrdp.tmp
echo.>>%tmp%\_Dosrdp.tmp
echo Video [.] 1024*768 [.] 800*600 [.] 640*480 >>%tmp%\_Dosrdp.tmp
echo (fixed on 640*480 with unregistered version) >>%tmp%\_Dosrdp.tmp
echo Refresh [$ rdp_refr,4,U]>>%tmp%\_Dosrdp.tmp
echo 16b Color [!] (default 8 bit) >>%tmp%\_Dosrdp.tmp
echo No Splash [!] >>%tmp%\_Dosrdp.tmp
echo Vesa TSR [!] (load Univesa/Univbe if available) >>%tmp%\_Dosrdp.tmp
echo.>>%tmp%\_Dosrdp.tmp
echo Keyboard [$ rdp_keyb,4,L] (enter 1033 for US layout) >>%tmp%\_Dosrdp.tmp
echo Ms-mouse [!] (default Logitech-mouse) >>%tmp%\_Dosrdp.tmp
echo.>>%tmp%\_Dosrdp.tmp
echo [ Save ] [? Cancel ]>>%tmp%\_Dosrdp.tmp
set wcb1=%rdp_ncfg%
if "%rdp_color%"=="16" set wcb2=1
if "%rdp_flash%"=="no" set wcb3=1
if "%rdp_vesa%"=="1" set wcb4=1
if "%rdp_mouse%"=="ms" set wcb5=1
set wrb=3
if "%rdp_video%"=="1024*768" set wrb=1
if "%rdp_video%"=="800*600" set wrb=2
call w.bat box @%tmp%\_Dosrdp.tmp:w_config
if errorlevel 2 goto _end
set rdp_ncfg=%wcb1%
set rdp_color=8
if "%wcb2%"=="1" set rdp_color=16
set rdp_flash=yes
if "%wcb3%"=="1" set rdp_flash=no
set rdp_vesa=%wcb4%
set rdp_mouse=logitech
if "%wcb5%"=="1" set rdp_mouse=ms
set rdp_video=640*480
if "%wrb%"=="1" set rdp_video=1024*768
if "%wrb%"=="2" set rdp_video=800*600
set t_out=1
call drd.bat %srcdrv%
if errorlevel 1 set t_out=0
wbat box @%0:w_wprot #1,%t_out%
set t_out=
if errorlevel 2 goto _start
echo DOSRDP: Saving configuration...
set w_pass=%rdp_pass%
set rdp_pass=
set | tfind /f1,4 "rdp_">%tmp%\_Dosrdp.bat
set rdp_pass=%w_pass%
set w_pass=
if not exist %srcdrv%\etc\*.* mkdir %srcdrv%\etc
if not exist %ramdrv%\etc\global.set goto _yglob
xgrep -syv "^[:s]*@*[:s]*s?e?t?[:s]*rdp_.+=" %ramdrv%\etc\global.set >>%tmp%\_Dosrdp.bat
:_yglob
type %tmp%\_Dosrdp.bat >%srcdrv%\etc\global.set
type %tmp%\_Dosrdp.bat >%ramdrv%\etc\global.set
if exist %srcdrv%\etc\Dosrdp.set del %srcdrv%\etc\Dosrdp.set >%tmp%\nul
if exist %ramdrv%\etc\Dosrdp.set del %ramdrv%\etc\Dosrdp.set >%tmp%\nul
echo DOSRDP: Configuration saved to %srcdrv%\etc\global.set
echo.
goto _install
:w_cfg "Run DosRdp or go config?" [x]
(~press any key~: #? sec.)
Running DosRdp ...
(Terminal Services for DOS)
http://www.terminalsoft.net/
Target: [$ rdp_srvr,40 ]
If 'Target' is blank DosRdp will
not launch. Please supply Target
Server here, on the commandline,
or by entering 'Config'-mode.
Registered users please copy your
G4W.DAT to %srcdrv%\ETC and your G2.EXE
to %srcdrv%\BIN to prevent demo-mode
behaviour of auto-disconnecting
every 15 minutes.
[ Ok ] [ Config ] [? Abort ]
::
:w_wprot "Disable write protection..." [x]
If the disk in drive %srcdrv% is write
protected, please disable the write
protection now in order to save settings.
You can re-enable write protection after
saving.
[ Ok ] [? Cancel ]
::
:_usage
echo Parameters:
echo -c Config mode
echo -h This help info
echo address Target Server (by IP-address or DNS name)
echo.
goto _end
:_error
set rdp_pass=
shift
shift
echo.
echo DOSRDP: Error%errorlevel% %1 %2 %3 %4 %5 %6 %7 %8
echo.
@rem pause
goto _end
:_abort
echo DOSRDP: Aborted...
echo.
@rem pause
:_end
set rdp_pass=
set | tfind /f1,2 "W_" >%tmp%\_Dosrdp.tmp
set | tfind /f1,4 "rdp_" >>%tmp%\_Dosrdp.tmp
type %tmp%\_Dosrdp.tmp | lmod /L* /B= set [$1]=>%tmp%\_Dosrdp.bat
call %tmp%\_Dosrdp.bat
if exist %tmp%\_Dosrdp.* del %tmp%\_Dosrdp.*
set _dosrdp=
set ?=
set wcb1=
set wcb2=
set wcb3=
set wcb4=
set wcb5=
set wcb6=
set wcb7=
set wcb8=
set wcb9=
set wrb=
set wbat=
:: Dosrdp End ::